local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseComponent());

-- local ShieldPerfab =CommonOHOH:GetPath_Loop("Resource.Effect.Shield",game.ReplicatedStorage)


function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);

    self.player=self.parent.player
    self.player.BattleSateEvent:Connect(function(isEnter)
        if isEnter then
            self:Show()
        else
            self:Hide()
        end
    end)
    
end;

function M.dtor(self)
	M.super.dtor(self);
end


function M.Show(self)
    -- local root=self.parent:GetRootPart_Check()

   
    -- local touch=Instance.new("Part",root)
    -- touch.Transparency=0.5
    -- touch.Position=self.parent:GetPosition()
    -- local w=Instance.new("WeldConstraint",touch)
    -- w.Part0=touch
    -- w.Part1=root
    -- touch.CanCollide=false
    -- touch.Shape=Enum.PartType.Ball
    -- local r=self.parent:GetHurtR()
    -- touch.Size=Vector3.new(r,r,r)
    -- touch.Anchored=false
    -- self.HurtPart=touch


    -- self.Shield.Parent=self.parent.main_inst
    -- local startPos= self.Shield:WaitForChild("StartPos")
    -- local hurt= self.Shield:WaitForChild("hurt")

    -- local pos=self.parent:GetCFrame():PointToWorldSpace(startPos.Value)
    -- self.Shield.Position=pos
    -- hurt.Position=pos

    -- local attVal= self.Shield:WaitForChild("CharacterCF")
    -- self.HingeConstraintAtt=Instance.new("Attachment",root)
    -- self.HingeConstraintAtt.CFrame=attVal.Value
    -- self.HingeConstraintAtt.Name="Shield"

    -- local hingeConstraint= self.Shield:WaitForChild("HingeConstraint")
    -- hingeConstraint.Attachment1= self.HingeConstraintAtt

end


function M.Hide(self)
	if self.HurtPart then
        self.HurtPart:Destroy()
        self.HurtPart=nil
    end
end


return M

